using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WPCoco.Tasks
{
    public class EaseInOutFunction : EaseFunction
    {
        public EaseInOutFunction(float rate)
        {
            this.rate = rate;
        }

        readonly float rate;

        public override float Evaluate(float time)
        {
            time *= 2;
            if (time < 1)
                return (float)(0.5f * Math.Pow(time, rate));
            else
                return (float)(0.5f * Math.Pow(time - 1, rate) + 0.5f);
        }
    }
}
